<div class="modal fade product-edit-modal">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" *ngIf="product.id">编辑</h4>
                <h4 class="modal-title" *ngIf="!product.id">新增</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" #producteditForm="ngForm">
                    <div class="box-body">
                        <div class="form-group" [class.has-error]="name.valid ===false &&(name.dirty || name.touched)">
                            <label class="col-sm-3 control-label">名称</label>
                            <div class="col-sm-8">
                                <input type="text" pattern="^[A-Za-z0-9_\u4e00-\u9fa5]+$" minlength="2" maxlength="12" #name="ngModel" required [(ngModel)]="product.name" name="name" class="form-control" placeholder="请输入由英文字母、数字、汉字、下划线组成的4-12位字符的产品名称">
                            </div>
                        </div>
                        <div class="form-group" [class.has-error]="username.valid ===false &&(username.dirty || username.touched)">
                            <label class="col-sm-3 control-label">负责人</label>
                            <div class="col-sm-8">
                                <input type="text" pattern="^[A-Za-z0-9_\u4e00-\u9fa5]+$" minlength="2" maxlength="12" #username="ngModel" required [(ngModel)]="product.username" name="username" class="form-control" placeholder="请输入负责人名称(平台用户登录名称)">
                            </div>
                        </div>
                        <div class="form-group" [class.has-error]="status.valid ===false &&(status.dirty || status.touched)">
                            <label class="col-sm-3 control-label">是否启用</label>
                            <div class="col-sm-8">
                                <select class="form-control" [(ngModel)]="product.status" name="status" #status="ngModel">
                                              <option value="todo">待处理</option>
                                              <option value="ing">处理中</option>
                                              <option value="finish">已完成</option>
                                          </select>
                              </div>
                        </div>
                           <div class="form-group controls input-append date form_date" [class.has-error]="startDate.valid ===false &&(startDate.dirty || startDate.touched)" data-date="" data-date-format="yyyy-mm-dd hh:ii:ss" data-link-field="dtp_input2" data-link-format="yyyy-mm-dd">
                         <!-- <div class="form-group" [class.has-error]="startDate.valid ===false">  -->
                            <label class="col-sm-3 control-label">开始日期</label>
                            <div class="col-sm-8">

                                       <input type="text" (click)="getstartDate()" (blur)="onblurgetstartDate()" #startDate="ngModel" required class="form-control" id='startDate' [(ngModel)]="product.startDate" name="startDate" >

                                         <!-- <input  type="text" value="" readonly required class="form-control" > -->
                                     <!-- <input type="text" name="datetime" class="ui_timepicker" value="2015-3-25 13:40:10"> -->

                                        <!-- <span class="add-on"><i class="icon-th"></i></span> -->
                                    <!-- </div> -->
                             </div>
                         </div>
                        <div class="form-group" [class.has-error]="endDate.valid ===false &&(endDate.dirty || endDate.touched)">
                            <label class="col-sm-3 control-label">结束日期</label>
                             <div class="col-sm-8">
                                <!-- <input type="number" [(ngModel)]="product.attempts" name="attempts" class="form-control" placeholder="请输入重试次数"> -->
                                <!-- <input type="date" [(ngModel)]="product.endDate" name="endDate" class="col-sm-8"> -->
                                  <!-- <input type="date" class="form-control pull-right" [(ngModel)]="product.endDate" name="endDate"> -->
                                  <input type="text" (click)="getendDate()" (blur)="onblurgetendDate()" #endDate="ngModel" required class="form-control" id="endDate" [(ngModel)]="product.endDate" name="endDate" >
                             </div>
                        </div>
                        <div class="form-group" [class.has-error]="number.valid ===false &&(number.dirty || number.touched)">
                            <label class="col-sm-3 control-label">数量</label>
                            <div class="col-sm-8">
                                <input type="text" pattern="^[0-9]*[1-9][0-9]*$" maxlength="6" #number="ngModel" required [(ngModel)]="product.count" name="count" class="form-control" placeholder="请输数量">
                            </div>
                        </div>
                         <!-- <div class="form-group" *ngIf="product.type=='auto'">
                            <label class="col-sm-3 control-label">创建</label>
                            <div class="col-sm-8">
                                <input type="text" [(ngModel)]="product.createdAt" name="cron" class="form-control" placeholder="请输入执行规则">
                            </div>
                        </div> -->
                        <!-- <div class="form-group" *ngIf="product.type=='auto'">
                            <label class="col-sm-3 control-label">更新</label>
                            <div class="col-sm-8">
                                <select class="form-control" [(ngModel)]="product.updatedAt" name="isActive">
                                     <option value="true">启用</option>
                                    <option value="false">停止</option>
                                </select>
                            </div>
                        </div> -->
                        <!-- <div class="form-group">
                            <label class="col-sm-3 control-label" [(ngModel)]="product.deletedAt" name="deletedAt">删除</label>
                            <div class="col-sm-8">
                                 <select class="form-control" [(ngModel)]="product.deletedAt" name="orderType">
                                 </select>
                            </div>
                        </div> -->
                        <!-- <div class="form-group">
                            <label class="col-sm-3 control-label">操作</label>
                            <div class="col-sm-8">
                                <textarea class="form-control" rows="3" placeholder="请输入脚本" [(ngModel)]="product.order" name="order"></textarea>
                            </div>
                        </div> -->
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default pull-left" data-dismiss="modal">取消</button>
                <button type="button" (click)="createOrUpdate()"  [disabled]="!producteditForm.form.valid" class="btn btn-primary" >保存</button>
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>
<!-- /.modal -->
